<?php
class Api_Calls_Session extends Api_Calls
{
	public static function isLoggedIn()
	{
		$visitor = XenForo_Visitor::getInstance();
		return $visitor->getUserId();
	}
	
	public static function loggIn($userName, $userPw)
	{
				$loginModel = self::getModelFromCache('XenForo_Model_Login');
				$userModel = $this->getModelFromCache('XenForo_Model_User');
				$userId = $userModel->validateAuthentication($userPw, $userPw, $error);
				if (!userId)
				{
					$loginModel->logLoginAttempt($data['login']);
					die('fehler');
				}
				XenForo_Model_Ip::log($userId, 'user', $userId, 'login');

				XenForo_Application::get('session')->changeUserId($userId);
				XenForo_Visitor::setup($userId);
	}
}